﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.LongER.Framework.Utils;
using Com.LongER.Business.ZAH001;
using Com.LongER.Framework.Utils.LogUtils;

public partial class ZAH001 : System.Web.UI.Page
{
    /// <summary>
    /// 
    /// </summary>
    private Log log = Log.GetInstance();



    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
       
        log.Debug("page_load 001");


        Label lblPageId = (Label)Master.FindControl("lblPageId");
        lblPageId.Text = "ZAH001";

        Label lblPageName = (Label)Master.FindControl("lblPageName");
        lblPageName.Text = "登录画面";

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn关闭_Click(object sender, EventArgs e)
    {
        Response.Write("<script>window.close();</script>");
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn登录_Click(object sender, EventArgs e)
    {
        IZAH001 instance = new CZAH001();
        ZAH001DS.USER_TBLDataTable user = instance.GetUserDataByUserid(this.txt用户ID.Text.ToString(),this.txt密码.Text.ToString());
        
        //
        if (user.Count.Equals(0))
        {
            String msg = MessageUtil.GetMessage("ZAH001", "EZAH001001");

            Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
            lblMsgCD.Text = "EZAH001001";

            Label lblMsg = (Label)Master.FindControl("lblMsg");
            lblMsg.Text = msg;

            return;
        }

        //
        try
        {
            if (Session["LoginInfo"] != null)
            {
                LoginInfo LoginInfo = (LoginInfo)Session["LoginInfo"];
                LoginInfo.USERID_HANZI = user[0].USERID_HANZI.ToString();
                LoginInfo.ZHIWEI = user[0].ZHIWEI_HANZI.ToString();
                LoginInfo.BUMEN = user[0].BUMEN_HANZI.ToString();
                LoginInfo.USERID = user[0].USERID.ToString();
                LoginInfo.PWD = user[0].PWD.ToString();

                Response.Redirect("/LongER/ZAH003.aspx");
            }
        }catch(HttpException ex)
        {
            log.Error(ex.ToString());
        }
       


    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn密码修改_Click(object sender, EventArgs e)
    {
        Response.Redirect("/LongER/ZAH002.aspx");
    }
}